 /**
 * @file 
 * @author Liutao
 * @date 2017-8-12
 * @brief 睡眠质量算法
 */
 
 #ifndef    SLEEP_QUALITY_ALGORITHM_H_
 #define    SLEEP_QUALITY_ALGORITHM_H_
 
  #include "stdint.h"
 
enum
{
    SLEEP_QUALITY_DATA_TYPE_MASTER_START = 1,
    SLEEP_QUALITY_DATA_TYPE_MASTER_END,
    SLEEP_QUALITY_DATA_TYPE_NORMAL_START,
    SLEEP_QUALITY_DATA_TYPE_NORMAL_END,
    SLEEP_QUALITY_DATA_TYPE_INSLEEPING,
};    
typedef struct
{
    struct
    {
        uint8_t     data_type:4;
        uint8_t     valid_time:4;
    }flag;
    uint8_t         quality;
}sleep_quality_t;
 
void sleep_quality_algorithm(uint16_t *p_data, sleep_quality_t *p_quality, uint16_t data_len);
 #endif
